<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <style>
        body{
            background: #2C4257;
            color:#fff;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row">
        <!-- 循环菜单 -->
        <div class="col-md-6">
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">

                <div class="menu_section">
                    <h3>菜单</h3>
                    <ul class="nav side-menu">
                        <li><a>东院区<span class="fa fa-chevron-down"></span><button class="btn btn-danger"  onclick="addWarehouse(1)" type="button"><i class="glyphicon glyphicon-plus"></i>添加</button></a>
                            <ul class="nav child_menu">
                                <li><a>一级库<span class="fa fa-chevron-down"></span></a>
                                    <ul class="nav child_menu">
                                        <c:forEach var="wa" items="${warehouses}">
                                            <c:if test="${wa.warehouseClass=='1'&& wa.branchCode=='100101'}">
                                                <li><a onclick="searchByWarehouse(${wa.warehouseCode})">${wa.warehouseName}<button class="btn btn-danger" onclick="deleteWarehouse(${wa.warehouseId})" type="button"><i class="glyphicon glyphicon-remove"></i>删除</button></a></li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                </li>
                                <li><a>二级库<span class="fa fa-chevron-down"></span></a>
                                    <ul class="nav child_menu">
                                        <c:forEach var="wa" items="${warehouses}">
                                            <c:if test="${wa.warehouseClass=='2'&& wa.branchCode=='100101'}">
                                                <li><a onclick="searchByWarehouse(${wa.warehouseCode})">${wa.warehouseName}<button class="btn btn-danger" onclick="deleteWarehouse(${wa.warehouseId})" type="button"><i class="glyphicon glyphicon-remove"></i>删除</button></a></li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                </li>
                            </ul>
                        </li>
                        <li><a>西院区<span class="fa fa-chevron-down"></span><button class="btn btn-danger" onclick="addWarehouse(2)" type="button"><i class="glyphicon glyphicon-plus"></i>添加</button></a>
                            <ul class="nav child_menu">
                                <li><a>一级库<span class="fa fa-chevron-down"></span></a>
                                    <ul class="nav child_menu">
                                        <c:forEach var="wa" items="${warehouses}">
                                            <c:if test="${wa.warehouseClass=='1'&& wa.branchCode=='100102'}">
                                                <li><a onclick="searchByWarehouse(${wa.warehouseCode})">${wa.warehouseName}<button class="btn btn-danger" onclick="deleteWarehouse(${wa.warehouseId})" type="button"><i class="glyphicon glyphicon-remove"></i>删除</button></a></li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                </li>
                                <li><a>二级库<span class="fa fa-chevron-down"></span></a>
                                    <ul class="nav child_menu">
                                        <c:forEach var="wa" items="${warehouses}">
                                            <c:if test="${wa.warehouseClass=='2'&& wa.branchCode=='100102'}">
                                                <li><a onclick="searchByWarehouse(${wa.warehouseCode})">${wa.warehouseName}<button class="btn btn-danger" onclick="deleteWarehouse(${wa.warehouseId})" type="button"><i class="glyphicon glyphicon-remove"></i>删除</button></a></li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 进行赋值 -->
        <div class="col-md-6" id="menu">
            <form action="" id="upWarehouse">
                <div class="row">
                    <div class="col-md-6">
                        <label>仓库名称:</label>
                        <input type="text" name="warehouseName" class="form-control">
                        <input type="hidden" name="warehouseId" class="form-control">
                    </div>
                    <div class="col-md-6">
                        <label>仓库编码:</label>
                        <input type="text" name="warehouseCode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <label>仓库级别:</label>
                        <input type="text" name="warehouseClass" class="form-control" readonly="readonly">
                    </div>
                    <div class="col-md-6">
                        <label>所属院区:</label>
                        <input type="text" name="branchCode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="row">

                    <div class="col-md-6">
                        <label>是否可用:</label><br>
                        <select name="deleteFlag" class="form-control">
                            <option value="Y">在用</option>
                            <option value="N">禁用</option>
                        </select>
                    </div>
                </div>
                <br>
                <div class="row">
                    <div class="col-md-9" >
                    </div>
                    <div class="col-md-2" >
                        <button type="button" onclick="updateWarehouse()" class="btn right btn-success">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<div id="AddWarehouse" style="color:#000;">
    <form class="form-horizontal" id="adWarehouse">
        <div class="row">
            <div class="form-group col-md-6">
                <label>仓库名称:</label>
                <input type="text" name="warehouseName" class="form-control">
            </div>
            <div class="form-group col-md-6">
                <label>仓库编码:</label>
                <input type="text" name="warehouseCode" class="form-control" readonly="readonly">
            </div>
        </div>
        <div class="row">
            <div class="form-group col-md-6">
                <label>仓库级别:</label>
                <select name="warehouseClass" class="form-control">
                    <option value="1">一级库</option>
                    <option value="2">二级库</option>
                </select>
            </div>
            <div class="form-group col-md-6">
                <label>所属院区:</label>
                <input type="text" name="branchCode" value="" class="hidden" >
                <select name="branchCode" class="form-control" disabled="disabled">
                </select>
            </div>
        </div>
        <div class="row">
            <div class="form-group col-md-6">
                <label>是否可用:</label><br>
                <select name="deleteFlag" class="form-control">
                    <option value="Y">在用</option>
                    <option value="N">禁用</option>
                </select>
            </div>
        </div>

    </form>
</div>
<%@include file="/WEB-INF/pages/common/modal.jsp"%>
<script src="res/js/warehouse.js"></script>
</body>
</html>